package com.uzai.common.enums;

/**
 * chat 消息来源(0用户消息；1机器人回复； 2客服系统回复)
 * @Auther: cen
 * @Date: 2022-1-4 15:00:07
 * @Description:
 */
public enum MessageSourceEnum {

    USER_SEND(0,"用户发送"),
    ROBOT_REPLY(1,"1机器人回复"),
    CS_REPLY(2,"2客服系统回复");

    private Integer id;
    private String desc;

    MessageSourceEnum(Integer id, String desc) {
        this.id = id;
        this.desc = desc;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public static MessageSourceEnum getById(Integer id) {
        if (id == null) {
            return null;
        }
        for (MessageSourceEnum type: MessageSourceEnum.values()) {
            if (type.getId().intValue() == id) {
                return type;
            }
        }
        return null;
    }
}
